<?php
namespace app\zhihui\controller;

use app\common\model\ZhEpisode as ZhEpisodeModel;
use app\home\controller\Base;
use think\Db;
/**
 * 高僧大德控制器
 * Class Zhmonks
 * @package app\index\controller
 */
class Zhepisode extends Base
{
    /**
     * [index  列表]
     * @return json
     * @author [C。]
     */
    public function index()
    {
        $param = input('param.');
        $model = new ZhEpisodeModel;
        $map = [];
        try {
            $map['states'] = 1;
            $map['vid'] = $param['vid'];
            $data = $model->getlist($map,'id,number,url,play_num,jplay_num,intro');
        } catch (\Exception $e) {
            systembug($e->getMessage(),2,$this->url);
            return admin_json(-1, $e->getMessage());
        }
        return admin_json(1, '获取成功', $data);
    }
    /**
     * [addplaynum  增加播放次数]
     * @return json
     * @author [C。]
     */
    public function addplaynum()
    {
        $param = input('param.');
        try {
            Db::name('zh_episode')->where('id',$param['id'])->setInc('play_num');
        } catch (\Exception $e) {
            systembug($e->getMessage(),2,$this->url);
            return admin_json(-1, $e->getMessage());
        }
        return admin_json(1, '成功');
    }
}